1# application/models/detection/product_model.py
from sqlalchemy import Column, BigInteger, String, DateTime
from application.models.base import Base
from sqlalchemy.orm import relationship

class ProductModel(Base):
    """产品型号数据模型"""
    
    __tablename__ = "detection_product_model"
    
    # 主键
    product_model_id = Column(BigInteger, primary_key=True, comment="产品型号ID")
    
    # 产品信息
    product_name= Column(String(30), comment="产品名称")
    product_model = Column(String(30), comment="产品型号")
    product_type = Column(String, comment="产品类型")
    product_phase = Column(String, comment="产品相位")
    power_factor = Column(String, comment="功率因数")
    polarity = Column(String, comment="极性")
    rate_frequency = Column(String(10), comment="额定频率")
    rate_voltage = Column(String(10), comment="额定电压")
    rate_current = Column(String(10), comment="额定电流")

    # 关联产品
    products = relationship("Product", back_populates="model")
    
    # 表注释
    __table_args__ = {"comment": "产品型号表"}